package com.tianzeculture.stagebao.net;

import com.tianzeculture.stagebao.bean.ArtistsDetailedBean;
import com.tianzeculture.stagebao.bean.HomeBean;
import com.tianzeculture.stagebao.bean.ResultBean;
import com.tianzeculture.stagebao.bean.TypeDetailListBean;
import com.tianzeculture.stagebao.net.base.AppBaseRestUsageV2;
import com.tianzeculture.stagebao.network.net.httpclient.NewCustomResponseHandler;
import com.tianzeculture.stagebao.util.Util;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/7/18 0018.
 */

public class HomeRestUsage extends AppBaseRestUsageV2 {

    private final String TO_INDEX = "/index/toIndex.do";//首页
    private final String TO_SYSTEM_NEWS = "/index/toSystemNews.do";//系统消息
    private final String APPEND_VIDEO = "/index/appendVideo.do";//加载视频
    private final String APPEND_PRC = "/index/appendPrc.do";//加载艺人套图
    private final String OTHER_INFO = "/user/otherInfo.do";//获取艺人资料
    private final String PROFESSION_PARENT = "/search/professioParent.do";//获取职业详情列表
    private final String SEARCH_FIRST = "/index/searchFirst.do";//主页搜索


    /**
     * 首页
     */
    public void toIndex(int taskId, String searchArea, String search) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("searchArea", searchArea);
        paramMap.put("search", search);
        post(TO_INDEX, Util.returnRealParam(paramMap), new NewCustomResponseHandler<HomeBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }

    /**
     * 系统消息
     */
    public void toSystemNews(int taskId, int page, int pageSize) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("page", String.valueOf(page));
        paramMap.put("pageSize", String.valueOf(pageSize));
        post(TO_SYSTEM_NEWS, Util.returnRealParam(paramMap), new NewCustomResponseHandler<ResultBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }

    /**
     * 加载视频
     */
    public void appendVideo(int taskId, String Page, String PageSize) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("Page", Page);
        paramMap.put("PageSize", PageSize);
        post(APPEND_VIDEO, Util.returnRealParam(paramMap), new NewCustomResponseHandler<HomeBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }

    /**
     * 加载艺人套图
     */
    public void appendPrc(int taskId, String Page, String PageSize) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("Page", Page);
        paramMap.put("PageSize", PageSize);
        post(APPEND_PRC, Util.returnRealParam(paramMap), new NewCustomResponseHandler<HomeBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }

    /**
     * 获取艺人资料
     */
    public void getOtherInfo(int taskId, String otherId) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("otherId", otherId);
        post(OTHER_INFO, Util.returnRealParam(paramMap), new NewCustomResponseHandler<ArtistsDetailedBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }

    /**
     * 主页搜索
     */
    public void searchName(int taskId, String nickname) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("nickname", nickname);
        post(SEARCH_FIRST, Util.returnRealParam(paramMap), new NewCustomResponseHandler<ResultBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }

    /**
     * 获取职业详情列表
     */
    public void getTypeDetail(int taskId, String search, String profession, String address, String sex, String price, int page, int size) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("nickname", search);
        paramMap.put("professio", profession);
        paramMap.put("address", address);
        paramMap.put("sex", sex);
        paramMap.put("price", price);
        paramMap.put("page", page + "");
        paramMap.put("size", size + "");
        post(PROFESSION_PARENT, Util.returnRealParam(paramMap), new NewCustomResponseHandler<TypeDetailListBean>(taskId) {
        }.setCallSuperRefreshUI(true));
    }
}
